module frontend.Types;

import necrophilia.Time;

alias LoopTimer!(float) Timer;

static import necrophilia.animation.Base;

alias necrophilia.animation.Base.Animation!(float) Animation;

import necrophilia.animation.Inteligent;

alias InteligentAnimationInstance!(Timer) AnimationInstance;

import frontend.Interpolation;

AnimationInstance getAnimationInstance(Animation anim){
	AnimationInstance result= new AnimationInstance(anim);
	result.setNewBorders(0.f,1.f);
	result.setOffsets(0,1);
	result.setInterpolationMethod(&linear);
	result.setInterpolationMethod(&slerp);
	return result;
}

static import necrophilia.skeleton.Skeleton;
static import necrophilia.skeleton.Bone;
import frontend.Inteligence;

alias necrophilia.skeleton.Bone.Bone!(AnimationInstance) Bone;
alias necrophilia.skeleton.Skeleton.Skeleton!(AnimationInstance, Bone) Skeleton;

alias necrophilia.skeleton.Skeleton.SkeletonCentral!(Skeleton) SkeletonCentral;

/+
	WHEN skeletalCentral is global, linker makes something strange, TODO : RAPORT!
+/

static import necrophilia.animation.Cache;
alias necrophilia.animation.Cache.AnimationCache!(Animation,AnimationInstance) AnimationCache;

AnimationCache animationCache;

Skeleton getSkeleton(){
	Skeleton skeleton=new Skeleton();
	skeleton.set(&sillyChoose);
	return skeleton;
}

static this() {
	SkeletonCentral skeletalCentral=new SkeletonCentral;
	Skeleton.central=skeletalCentral;
	animationCache=new AnimationCache();
	animationCache.setGetter(&getAnimationInstance);
	Skeleton.set(&animationCache.get);
	Skeleton.set(&getSkeleton);
}




